package com.example.mobile2121606097wjc0425;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.os.Bundle;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {
    private RecyclerView rvmainstudent;
    private List<Student> List;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        initDate();
        rvmainstudent.setLayoutManager(new LinearLayoutManager(this));
        StudentRVAdapter adapter = new StudentRVAdapter(List);
        rvmainstudent.setAdapter(adapter);
    }

    private void initDate() {
        List=new ArrayList<>();
        List.add(new Student("小明",20,"移动1班","13500001111"));
        List.add(new Student("小洪",19,"移动2班","13500001112"));
        List.add(new Student("小丽",21,"移动3班","13500001113"));
        List.add(new Student("小青",23,"移动4班","13500001114"));
        List.add(new Student("小张",22,"移动5班","13500001115"));
        List.add(new Student("小李",20,"移动6班","13500001116"));
    }

    private void initView() {
        rvmainstudent = (RecyclerView) findViewById(R.id.rvmainstudent);
    }

}